﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Globalization;

public partial class _Default : System.Web.UI.Page {
    private const string TEMPLATE_NAME = "Test";

    protected void Page_Load(object sender, EventArgs e) {

    }

    protected void SendSimpleButton_Click(object sender, EventArgs e) {
        Altairis.MailToolkit.Mailer.SendTemplatedMessage(
            this.RecipientAddressTextBox.Text,                  // recipient e-mail address
            TEMPLATE_NAME,                                      // template name
            this.Placeholder0TextBox.Text,                      // {0}
            this.Placeholder1TextBox.Text);                     // {1}
        this.MultiViewPage.SetActiveView(this.ViewMessage);
    }

    protected void SendReplyButton_Click(object sender, EventArgs e) {
        Altairis.MailToolkit.Mailer.SendTemplatedMessage(
            new MailAddress(this.ReplyToAddressTextBox.Text),   // reply-to e-mail address
            new MailAddress(this.RecipientAddressTextBox.Text), // recipient e-mail address
            TEMPLATE_NAME,                                      // template name
            this.Placeholder0TextBox.Text,                      // {0}
            this.Placeholder1TextBox.Text);                     // {1}
        this.MultiViewPage.SetActiveView(this.ViewMessage);
    }

    protected void SendSimpleLocalizedButton_Click(object sender, EventArgs e) {
        Altairis.MailToolkit.Mailer.SendTemplatedMessage(
            new CultureInfo("cs-CZ"),                           // localization culture
            this.RecipientAddressTextBox.Text,                  // recipient e-mail address
            TEMPLATE_NAME,                                      // template name
            this.Placeholder0TextBox.Text,                      // {0}
            this.Placeholder1TextBox.Text);                     // {1}
        this.MultiViewPage.SetActiveView(this.ViewMessage);
    }

    protected void SendReplyLocalizedButton_Click(object sender, EventArgs e) {
        Altairis.MailToolkit.Mailer.SendTemplatedMessage(
            new CultureInfo("cs-CZ"),                           // localization culture
            new MailAddress(this.ReplyToAddressTextBox.Text),   // reply-to e-mail address
            new MailAddress(this.RecipientAddressTextBox.Text), // recipient e-mail address
            TEMPLATE_NAME,                                      // template name
            this.Placeholder0TextBox.Text,                      // {0}
            this.Placeholder1TextBox.Text);                     // {1}
        this.MultiViewPage.SetActiveView(this.ViewMessage);
    }

}